package com.dianjing.dianqun.utils;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.context.annotation.ComponentScan;

import com.dianjing.dianqun.dao.dianpai.DianQunUserMapper;
import com.dianjing.dianqun.model.DianQunUser;

/**
 * @date : 2017年10月11日
 * 
 * @author: baoyongtao
 * 
 * @see :
 * 
 */
@ComponentScan
public class UserUtils {
	
	static DianQunUserMapper dianQunUserMapper=SpringUtils.getBean(DianQunUserMapper.class);

	/**
	 * 获取当前user
	 * @return
	 */
	public static DianQunUser getUser() {
		Subject subject = SecurityUtils.getSubject();
		return dianQunUserMapper.getUserByLoginName((String)subject.getPrincipal());

	}

}
